package com.example.demo.util;

import org.springframework.http.HttpMethod;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

@Component
public class ScheduleTask {

    //定时任务：每隔10秒获取一次数据，并保存到数据库
    // @Scheduled(cron = "*/10 * * * * ?")
    /*
    public void execute(){
        RestTemplate restTemplate=new RestTemplate();
        String url="http://127.0.0.1:8081/getdata";
        restTemplate.getForObject(url,String.class);
    }
*/
}